platform:
  - x86

image: Visual Studio 2015

environment:
  GOPATH: C:\gopath
  GOROOT: C:\go110-x86
  nodejs_version: '10.13.0'

stack: go 1.10

branches:
  only:
    - client-build

install:
  # Software we need - provided by Appveyor's VS2015 image:
  # Node 10.13.0
  # Yarn 1.9.4
  # Go 1.10.8
  # InnoSetup 5.x Unicode
  # MinGW 32-bit

  - ps: |
      $fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
      $fileContent += $env:SSH_KEY.Replace(' ', "`n")
      $fileContent += "`n-----END RSA PRIVATE KEY-----`n"
      Set-Content C:\Users\appveyor\.ssh\id_rsa $fileContent

  - ps: Install-Product node $env:nodejs_version

  # Enable VS2015 toolset
  - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

  - git submodule update --init --recursive

  # Get code signing cert
  - ps: |
      Set-Content $env:APPVEYOR_BUILD_FOLDER\gulp\tasks\client\certs\cert.pfx.b64 $env:GJ_CERT
      CertUtil -Decode $env:APPVEYOR_BUILD_FOLDER\gulp\tasks\client\certs\cert.pfx.b64 $env:APPVEYOR_BUILD_FOLDER\gulp\tasks\client\certs\cert.pfx

  # Make InnoSetup and MinGW tools accessible from path
  - set PATH=C:\Program Files (x86)\Inno Setup 5;C:\MinGW\bin;%GOROOT%\bin;%GOPATH%\bin;%PATH%
  - echo %PATH%

  - node --version
  - yarn --version
  - go version
  - gcc -v

build_script:
  - yarn install --ignore-engines
  - yarn run client-build-win
  # To make a test package, comment out the previous line and uncomment this line.
  # - yarn run client-build-win --useTestPackage

test: off

artifacts:
  - path: build\prod-client-build\GameJoltClientSetup.exe
  - path: build\prod-client-build\win32-package.tar.gz
